package com.example.demo.jpa.config.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Autowired
    UrlMappingInterceptor urlMappingInterceptor;

    @Autowired
    MockErrorInterceptor mockErrorInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(urlMappingInterceptor).excludePathPatterns("/error");
        registry.addInterceptor(mockErrorInterceptor).excludePathPatterns("/error");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
